<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>js模块化开发之对象写法</title>
    <script>
        /* 
            小A
            小B

            对外都是暴露的，
            我们希望可以进行私有化。
         */
        var moduleA = {
            count: 100,
            showA: function(){
                this.count += 10;
                alert(this.count);
            },
            showB: function(){
                this.count *= 20;
                alert(this.count);
            }
        };

        var moduleB = {
            count: 50,
            showA: function(){
                this.count += 100;
                alert(this.count);
            },
            showB: function(){
                this.count /= 20;
                alert(this.count);
            }
        };

        moduleA.count = "hello";
        moduleA.showA();
        moduleA.showB();

        moduleB.showA();
        moduleB.showB();
    </script>
</head>
<body>
    
</body>
</html>